<?php if (!empty($provincelist)) { ?>
<select name="provinceid" id="provinceid">
<?php echo $provincelist?>
</select>
<?php } ?>
<select name="cityid" id="cityid">
<?php if (!empty($citylist)) { ?>
<?php echo $citylist?>
<?php } ?>
</select>
<?php if ($count == 3) {?>
<select name="regionid" id="regionid">
<?php if (!empty($regionlist)) { ?>
<?php echo $regionlist?>
<?php } }?>
</select>
<script>
var count = '<?php echo $count?>';
$("#provinceid").change(function(){
	$.get('<?php echo site_url("module/commdata/region/getCity")?>' + "/" + $(this).val(), function(d){$("#cityid").html(d)});
	if (count == '3')
	{
		$("#regionid").html('<?php echo $firstoption?>');
	}
$("#address").val($(this).find("option:selected").text());
});
if (count == '3')
{
	$("#cityid").change(function(){
		$.get('<?php echo site_url("module/commdata/region/getRegion")?>' + "/" + $(this).val(), function(d){$("#regionid").html(d)});
		$("#address").val($("#provinceid").find("option:selected").text() + $(this).find("option:selected").text());
	});

	$("#regionid").change(function(){
		$("#address").val($("#provinceid").find("option:selected").text() + $("#cityid").find("option:selected").text() + $(this).find("option:selected").text());
	});
}
</script>